/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mortbay.jetty.pico.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Hnmtuan
 */
@Entity
@Table(name = "customer")
@NamedQueries({
    @NamedQuery(name = "Customer.findAll", query = "SELECT c FROM Customer c"),
    @NamedQuery(name = "Customer.findByIdCus", query = "SELECT c FROM Customer c WHERE c.idCus = :idCus"),
    @NamedQuery(name = "Customer.findByCusEmail", query = "SELECT c FROM Customer c WHERE c.cusEmail = :cusEmail"),
    @NamedQuery(name = "Customer.findByCusPass", query = "SELECT c FROM Customer c WHERE c.cusPass = :cusPass"),
    @NamedQuery(name = "Customer.findByCusFullName", query = "SELECT c FROM Customer c WHERE c.cusFullName = :cusFullName"),
    @NamedQuery(name = "Customer.findByCusSex", query = "SELECT c FROM Customer c WHERE c.cusSex = :cusSex"),
    @NamedQuery(name = "Customer.findByCusBOD", query = "SELECT c FROM Customer c WHERE c.cusBOD = :cusBOD"),
    @NamedQuery(name = "Customer.findByCusMobile", query = "SELECT c FROM Customer c WHERE c.cusMobile = :cusMobile"),
    @NamedQuery(name = "Customer.findByCusAddress", query = "SELECT c FROM Customer c WHERE c.cusAddress = :cusAddress"),
    @NamedQuery(name = "Customer.findByCusState", query = "SELECT c FROM Customer c WHERE c.cusState = :cusState"),
    @NamedQuery(name = "Customer.findByJoinDate", query = "SELECT c FROM Customer c WHERE c.joinDate = :joinDate")})
public class Customer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IdCus")
    private String idCus;
    @Column(name = "CusEmail")
    private String cusEmail;
    @Column(name = "CusPass")
    private String cusPass;
    @Column(name = "CusFullName")
    private String cusFullName;
    @Column(name = "CusSex")
    private Boolean cusSex;
    @Column(name = "CusBOD")
    @Temporal(TemporalType.TIMESTAMP)
    private Date cusBOD;
    @Column(name = "CusMobile")
    private String cusMobile;
    @Column(name = "CusAddress")
    private String cusAddress;
    @Column(name = "CusState")
    private Integer cusState;
    @Column(name = "JoinDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date joinDate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
    private List<CustomerLogs> customerLogsList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "customer1")
    private List<Saved> savedList;
    @JoinColumn(name = "CusCreditCard", referencedColumnName = "IdBanking")
    @ManyToOne(optional = false)
    private Banking banking;
    @OneToMany(mappedBy = "customer")
    private List<Order1> order1List;

    public Customer() {
    }

    public Customer(String idCus) {
        this.idCus = idCus;
    }

    public String getIdCus() {
        return idCus;
    }

    public void setIdCus(String idCus) {
        this.idCus = idCus;
    }

    public String getCusEmail() {
        return cusEmail;
    }

    public void setCusEmail(String cusEmail) {
        this.cusEmail = cusEmail;
    }

    public String getCusPass() {
        return cusPass;
    }

    public void setCusPass(String cusPass) {
        this.cusPass = cusPass;
    }

    public String getCusFullName() {
        return cusFullName;
    }

    public void setCusFullName(String cusFullName) {
        this.cusFullName = cusFullName;
    }

    public Boolean getCusSex() {
        return cusSex;
    }

    public void setCusSex(Boolean cusSex) {
        this.cusSex = cusSex;
    }

    public Date getCusBOD() {
        return cusBOD;
    }

    public void setCusBOD(Date cusBOD) {
        this.cusBOD = cusBOD;
    }

    public String getCusMobile() {
        return cusMobile;
    }

    public void setCusMobile(String cusMobile) {
        this.cusMobile = cusMobile;
    }

    public String getCusAddress() {
        return cusAddress;
    }

    public void setCusAddress(String cusAddress) {
        this.cusAddress = cusAddress;
    }

    public Integer getCusState() {
        return cusState;
    }

    public void setCusState(Integer cusState) {
        this.cusState = cusState;
    }

    public Date getJoinDate() {
        return joinDate;
    }

    public void setJoinDate(Date joinDate) {
        this.joinDate = joinDate;
    }

    public List<CustomerLogs> getCustomerLogsList() {
        return customerLogsList;
    }

    public void setCustomerLogsList(List<CustomerLogs> customerLogsList) {
        this.customerLogsList = customerLogsList;
    }

    public List<Saved> getSavedList() {
        return savedList;
    }

    public void setSavedList(List<Saved> savedList) {
        this.savedList = savedList;
    }

    public Banking getBanking() {
        return banking;
    }

    public void setBanking(Banking banking) {
        this.banking = banking;
    }

    public List<Order1> getOrder1List() {
        return order1List;
    }

    public void setOrder1List(List<Order1> order1List) {
        this.order1List = order1List;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCus != null ? idCus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customer)) {
            return false;
        }
        Customer other = (Customer) object;
        if ((this.idCus == null && other.idCus != null) || (this.idCus != null && !this.idCus.equals(other.idCus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.mortbay.jetty.pico.entities.Customer[idCus=" + idCus + "]";
    }

}
